import os
from flask import Blueprint, send_file
from util.file_util import getProjectRoot

static_blueprint = Blueprint('image', __name__)


@static_blueprint.route('/get/<path:file_name>', methods=['GET'])
def get_image(file_name):
    image_path = os.path.join(getProjectRoot(), 'static', 'image', file_name)

    # 根据图片路径发送图片文件
    return send_file(image_path, mimetype='image/jpg')
